#include <iostream>
#include <queue> // 里面有vector
#include <vector>
using namespace std;
 
#define int long long
const int INF = 0x3f3f3f3f3f3f3f3f;
 
signed main() // 打家劫舍dp？
{
    int n = 0, k = 0, d = 0;
    cin >> n;
    vector<int> arr(n + 1);
    for(int i = 1; i <= n; ++i)
    {
        cin >> arr[i]; // 还有负值
    }
    cin >> k >> d;
    vector<vector<int>> f(n + 1, vector<int>(k + 1, -INF));
    vector<vector<int>> g(n + 1, vector<int>(k + 1, INF));
    // f[i][j]/g[i][j]表示从1到i挑选j个人第i个人必选的最大/小乘积
    for(int i = 1; i <= n; ++i)
    {
        f[i][1] = g[i][1] = arr[i]; // 初始化
        for(int j = 2; j <= min(i, k); ++j)
        {
            // i - prev <= d 所以 prev >= i - d
            for(int prev = max(i - d, j - 1); prev <= i - 1; ++prev) // prev代表前面挑选的最后一个位置
            {
                f[i][j] = max(f[i][j], max(f[prev][j - 1] * arr[i], g[prev][j - 1] * arr[i]));
                g[i][j] = min(g[i][j], min(f[prev][j - 1] * arr[i], g[prev][j - 1] * arr[i]));
            }
        }
    }
    int res = 0;
    for(int i = k; i <= n; ++i)
    {
        res = max(res, f[i][k]);
    }
    cout << res << endl;
    return 0;
}